//
//  FlowTableViewCell.m
//  OpenYourEyes
//
//  Created by apple on 15/8/14.
//  Copyright (c) 2015年 zhanglei. All rights reserved.
//

#import "FlowTableViewCell.h"
#import "Header.h"

@implementation FlowTableViewCell

#pragma mark - 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self.contentView addSubview:self.labelFlow];
        [self.contentView addSubview:self.switchFlow];
    }
    return self;
}

- (UILabel *)labelFlow
{
    if(!_labelFlow)
    {
        self.labelFlow = [[UILabel alloc] initWithFrame:CGRectMake(15, 6, 100, 30)];
    }
    return _labelFlow;
}

- (UISwitch *)switchFlow
{
    if (!_switchFlow)
    {
        self.switchFlow = [[UISwitch alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 70, 6, 80, 30)];
        [self.switchFlow addTarget:self action:@selector(isOnWithOff:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _switchFlow;
}

- (void)isOnWithOff:(UISwitch *)isOnWithOff
{
    if (isOnWithOff.on)
    {
        _switchBlock();
    }
}

- (void)awakeFromNib
{
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
